import { onMounted, onBeforeUnmount } from 'vue';
import { debounce } from '@/utils/util';
export const useEventListener = ({ el = window, eventName = 'resize', fn, isDebounce = true }) => {
    let handler: any = null;
    handler = isDebounce ? debounce(fn, 260) : fn;
    onMounted(() => {
        el.addEventListener(eventName, handler);
    });
    onBeforeUnmount(() => {
        el.removeEventListener(eventName, handler);
    });
};